import { handleSearchLoading } from "@userList/search";
import { operateBehaviorMap, operateResultMap, operateModuleMap } from "./dict";
import { refreshTable } from ".";
const searchLoading = ref(false);
const resetLoading = ref(false);
export const tableActiveKey = ref(0);
export const searchList = ref([
  {
    label: getProxyT("table23"),
    type: "input",
    model: "aaaa",
    allowClear: true,
    placeholder: getProxyT("placeholder179"),
  },
  {
    label: getProxyT("table234"),
    type: "select",
    model: "bbbb",
    allowClear: true,
    searchClass: "search-item-width-150",
    placeholder: getProxyT("placeholder180"),
    options: operateModuleMap,
  },
  {
    label: getProxyT("table235"),
    type: "select",
    model: "cccc",
    allowClear: true,
    searchClass: "search-item-width-150",
    placeholder: getProxyT("placeholder181"),
    options: operateBehaviorMap,
  },

  {
    label: getProxyT("table236"),
    type: "select",
    model: "dddd",
    allowClear: true,
    searchClass: "search-item-width-150",
    placeholder: getProxyT("placeholder182"),
    options: operateResultMap,
  },
  {
    label: getProxyT("table44"),
    showTime: { format: "HH:mm:ss" },
    type: "rangePicker",
    model: "start_end",
    placeholder: computed(() => [$t("base.startTime"), $t("base.endTime")]),
    format: "YYYY-MM-DD HH:mm:ss",
  },
]);
export const searchConfig = () => {
  const defineSearch = {
    okText: getProxyT("base.query"),
    cancelText: getProxyT("base.reset"),
    searchLoading,
    resetLoading,
    refreshTableData: async (searchParams: any, type: any) => {
      handleSearchLoading(true, type, defineSearch);
      await refreshTable(searchParams);
      handleSearchLoading(false, type, defineSearch);
    },
    searchList,
  };
  return defineSearch;
};
